Other Functions

The following functions are available globally.

  • Applies the animation to the map viewport.

    Use this function to apply animation to viewport change.

    @Binding viewport: Viewport
    
    var body: some View {
        Button("Animate viewport") {
            withViewportAnimation {
                viewport = .camera(...)
            }
        }
    }
    

    See Viewport and ViewportAnimation documentation for more details.

    Declaration

    Swift

    @available(iOS 13.0, *)
    @_documentation(visibility: public)
    @_spi(Experimental)
    public func withViewportAnimation<Result>(
        _ animation: ViewportAnimation = .default,
        body: () throws -> Result,
        completion: ((Bool) -> Void)? = nil
    ) rethrows -> Result